package com.bugstack.domain.strategy.model.entity;

import com.bugstack.types.common.Constants;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Date;

/**
* @Author: czb
* @Description: 策略奖品实体
* @DateTime: 2025/3/3 16:51
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class StrategyEntity {
    /** 抽奖策略ID */
    private Long strategyId;
    /** 抽奖策略描 */
    private String strategyDesc;
    /** 抽奖规则模型 */
    private String ruleModels;

    public String[] ruleModels() {
        if (StringUtils.isBlank(ruleModels)) return null;
        return ruleModels.split(Constants.SPLIT);
    }

    public String getRuleWeights(){
        String[] RuleModels = this.ruleModels();
        if(null == RuleModels) return null;
        for(String ruleModel : RuleModels){
            if ("rule_weight".equals(ruleModel)) return ruleModel;
        }
        return null;
    }
}
